<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加教师</title>
<script>
	//表单提交前进行数据验证，数据合法则返回true表单提交
	function check(teacherform) {  
		if(teacherform.name.value=="") {  
	        swal("姓名不能为空","请重新输入","warning");  
	        return false;  
	    } 
		else if(teacherform.username.value=="") {  
	        swal("工号不能为空","请重新输入","warning");  
	        return false;  
	    }  
	    else if(!isNumber(teacherform.username.value)) {
	    	swal("工号不合法","请重新输入","warning");  
	        return false;  
	    }
	    else if(teacherform.birthday.value=="") {  
	    	swal("生日不能为空","请重新输入","warning");   
	        return false;  
	    }  
	    else if(teacherform.title.value=="") {
	    	swal("职称不能为空","请重新输入","warning");   
	        return false;  
	    } 
	    else if(teacherform.homephone.value=="") {  
	   	    swal("家庭电话不能为空","请重新输入","warning");   
	        return false;  
	    } 
	    else if(teacherform.phone.value=="") {  
	   	    swal("手机不能为空","请重新输入","warning");   
	        return false;  
	    }
	    else if(teacherform.email.value=="") {  
	   	    swal("邮箱不能为空","请重新输入","warning");   
	        return false;  
	    }

	    return true;  
	}   
	  
	function isNumber(str)          // 判断是否为非负整数  
	{  
	    var rx = /^[0-9]+$/;  
	    return rx.test(str);  
	} 
</script>
</head>
<body>
	<jsp:include page="../navbar.html" />
	<div class="container-fluid">
		<div class="row">
			<div class="col-md-1 col-md-offset-1">
				<a href="userManageServlet?method=list&type=t">
					<button type="button" class="btn btn-default"><em class="fa fa-chevron-left"></em> 返回</button>
				</a>
			</div>
		</div>
    	<div class="row">
    		<form name="teacherform" role="form" action="userManageServlet" method="post"  onsubmit="return check(this);" class="form-horizontal mt10">
				<div class="col-md-5 col-md-offset-1">
					<div class="panel">
	                	<div class="panel-body">
	                  		<h4 class="page-header mt0">教师必填信息</h4>
	                  	    <fieldset>
				              <div class="form-group">
				                  <label class="col-md-2 control-label">姓名</label>
				                  <div class="col-md-9">
				                     <input class="form-control" type="text" name="name" placeholder="请输入教师姓名" />
				                  </div>
				               </div> 
			                </fieldset>
		               		<fieldset>
			               		<div class="form-group">
			                  		<label class="col-md-2 control-label">工号</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="username" placeholder="请输入教师工号" />
		                  			</div>
		               			</div>	
		               		</fieldset> 
		                	<fieldset>
			               		<div class="form-group">
			               			<label class="col-md-2 control-label">性别</label>
			               			<div class="col-md-9">
			               				<label class="radio-inline c-radio">
                                 			<input id="inlineradio1" type="radio" name="sex" value="男" checked>
                                 			<span class="fa fa-circle"></span>男</label>
                        			 	<label class="radio-inline c-radio">
                           					<input id="inlineradio2" type="radio" name="sex" value="女">
                           					<span class="fa fa-circle"></span>女</label>
			               			</div>
			               		</div>	
		               		</fieldset>  
		               		<fieldset>
		               			 <div class="form-group">
			                  		<label class="col-md-2 control-label">生日</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="date" name="birthday" placeholder="请输入教师生日" />
		                  			</div>
		               			</div>
		               		</fieldset> 
		               		<fieldset>
				              <div class="form-group">
				                  <label class="col-md-2 control-label">职称</label>
				                  <div class="col-md-9">
				                     <input class="form-control" type="text" name="title" placeholder="请输入教师职称" />
				                  </div>
				               </div> 
			                </fieldset>
		               		<fieldset>
			              		<div class="form-group">
			                  		<label class="col-md-2 control-label">家庭电话</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="homephone" placeholder="请输入教师家庭电话" />
		                  			</div>
		               			</div>
		               		</fieldset> 
		               		<fieldset>
			              		<div class="form-group">
			                  		<label class="col-md-2 control-label">手机</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="phone" placeholder="请输入教师手机" />
		                  			</div>
		               			</div>
		               		</fieldset>
		               		<fieldset>
			              		<div class="form-group">
			                  		<label class="col-md-2 control-label">邮箱</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="email" placeholder="请输入教师邮箱" />
		                  			</div>
		               			</div>
		               		</fieldset>           
	               		</div>
	            	</div>
	         	</div>
	         	<div class="col-md-5">
					<div class="panel">
	                	<div class="panel-body">
	                  		<h4 class="page-header mt0">教师选填信息</h4>	                  	
		               		<fieldset>
			               		<div class="form-group">
			                  		<label class="col-md-2 control-label">最后学历</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="finaleducation" placeholder="请输入教师最后学历" />
		                  			</div>
		               			</div>	
		               		</fieldset> 
		                	<fieldset>
			               		<div class="form-group">
			                  		<label class="col-md-2 control-label">最后学历毕业院校</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="finaleducationschool" placeholder="请输入教师最后学历毕业院校" />
		                  			</div>
		               			</div>
		               		</fieldset>  
		               		<fieldset>
		               			 <div class="form-group">
			                  		<label class="col-md-2 control-label">最后学位</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="finaldegree" placeholder="请输入教师最后学位" />
		                  			</div>
		               			</div>
		               		</fieldset> 
		               		<fieldset>
			              		<div class="form-group">
			                  		<label class="col-md-2 control-label">最后学位毕业院校</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="finaldegreeschool" placeholder="请输入教师最后学位毕业院校" />
		                  			</div>
		               			</div>
		               		</fieldset> 
		               		<fieldset>
			              		<div class="form-group">
			                  		<label class="col-md-2 control-label">研究方向</label>
		                  			<div class="col-md-9">
		                     			<input class="form-control" type="text" name="researchdirection" placeholder="请输入教师研究方向" />
		                  			</div>
		               			</div>
		               		</fieldset>
		               		<fieldset>
			              		<div class="form-group">
			                  		<label class="col-md-2 control-label">备注</label>
		                  			<div class="col-md-9">
		                     			<textarea class="form-control no-resize" name="mark" placeholder="请输入备注" rows="7"></textarea>
		                  			</div>
		               			</div>
		               		</fieldset>  
		               		<input type="hidden" name="type" value="t">         
	               		</div>
	            	</div>
	         	</div>
	         	<div class="col-md-10 col-md-offset-1 mb20">
          			<div class="col-md-6">
          				<button type="submit" class="btn btn-primary btn-block" name="method" value="add">添加</button> 
          			</div>
          			<div class="col-md-6">
          				<button type="reset" class="btn btn-default btn-block">重置</button> 
          			</div>
          		</div>
         	</form>
       </div>
    </div>
</body>
</html>